package com.create404.suishoupai.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.create404.suishoupai.entity.PhotoRecord;
import com.create404.suishoupai.vo.PhotoRecordVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author create404
 * @since 2021-07-17
 */
public interface PhotoRecordMapper extends BaseMapper<PhotoRecord> {
    // 获取带有员工姓名的实体类
//    @Select("SELECT a.name AS publisher_name, b.name AS responsible_name, c.* FROM photo_record c INNER JOIN employee a ON c.employee_id = a.employee_id INNER JOIN employee b ON  c.responsible_id = b.employee_id ORDER BY `status` DESC, update_time DESC")
    List<PhotoRecordVO> getPhotoRecordList();
    List<PhotoRecordVO> getPhotoRecordListType1();
    List<PhotoRecordVO> getPhotoRecordListType2();
    PhotoRecordVO queryById(int id);

    @Select("SELECT  * FROM photo_record ORDER BY id DESC LIMIT 1;")
    PhotoRecord getLatestOne();

    IPage<PhotoRecordVO> getMyPhotoRecords(Page<?> page, String employeeId);


}
